<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <script type="text/javascript" src="./script/rem.js"></script>
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/api.js"></script></head>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
</head>

<body>

    <!-- 分享模块 -->
    <div class="game-share" style="bottom:0">
        <ul>
            <li onclick="wxQiaoliaoShare();"><img src="image/foot-share-1.png"></li> 
            <li onclick="friendCircleQiaoliaoShare();"><img src="image/foot-share-2.png"></li> 
            <!-- <li><img src="image/foot-share-3.png"></li> -->
        </ul>
        <p onclick="closeShare();">取消</p>
        <img id="imgShare" src="" alt="">
    </div>

</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript" src="./script/index.js"></script>
<script type="text/javascript">

    apiready = function(){

        content = api.pageParam.content;
        url = api.pageParam.url;
        imgPath = api.pageParam.imgPath;
        title = api.pageParam.title;

    }
    
    // 分享千聊到微信
    function wxQiaoliaoShare(){

        var wx = api.require('wx');
        wx.shareWebpage({
           apiKey: 'wx7cf56a1ffd5ea7a1',
           scene: 'session',
           title: title,
           description: content,
           thumb: imgPath,
           contentUrl: url
       }, function(ret, err){
           // alert(JSON.stringify(ret));
           if (ret.status){
            api.toast({
                msg: '分享成功',
                duration: 2000,
                location: 'bottom',
                global: true,
            });
            api.closeFrame();
        }else{
            api.closeFrame();
            // alert(err.code);
        }
    });
    }

    // 分享千聊到朋友圈
    function friendCircleQiaoliaoShare(){

        var wx = api.require('wx');
        wx.shareWebpage({
           apiKey: 'wx7cf56a1ffd5ea7a1',
           scene: 'timeline',
           title: title,
           description: content,
           thumb: imgPath,
           contentUrl: url
       }, function(ret, err){
           // alert(JSON.stringify(ret));
           if (ret.status){
            api.toast({
                msg: '分享成功',
                duration: 2000,
                location: 'bottom',
                global: true,
            });
            api.closeFrame();
        }else{
            api.closeFrame();
            // alert(err.code);
        }
    });
    }

    function closeShare(){
        api.closeFrame();
    }

    // 小游戏竖屏
    function portraitUpGame(){
        api.setScreenOrientation({
            orientation: 'portrait_up'
        });
    }

    // 小游戏横屏
    function landscapeGame(){
        api.setScreenOrientation({
            orientation: 'landscape_left'
        });
    }

    function closeWin(){
        api.closeWin({
        });
    }
</script>
</html>